﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NFinal
{
    /// <summary>
    /// 魔法Action,包含一些需要生成器重写实现的函数
    /// </summary>
    public class MagicAction
    {
        public delegate void __Render__(NameValueCollection nvc);
        public __Render__ __render__ = null;
        public virtual string postEventArgumentID { get { return null; } }
        public virtual string postEventSourceID { get { return null; } }
        /// <summary>
        /// 插入Csharp代码段
        /// </summary>
        /// <param name="textFilePath">含有csharp代码的文本文件路径</param>
        public virtual void InsertCodeSegment(string textFilePath) { }
        /// <summary>
        /// 插入Csharp类文件函数中的代码段
        /// </summary>
        /// <param name="classFilePath">csharp类文件路径</param>
        /// <param name="methodName">类文件中的函数名</param>
        public virtual void InsertCodeSegment(string classFilePath, string methodName) { }
        /// <summary>
        /// 渲染html模板
        /// </summary>
        /// <param name="tplPath">模板相对路径,一般相对于App/Views/Default目录</param>
        public virtual void View(string tplPath) { }
        /// <summary>
        /// 渲染html模板
        /// </summary>
        /// <param name="name">模板样式</param>
        /// <param name="tplPath">模板相对路径,一般相对于App/Views/Default目录</param>
        public virtual void View(string name, string tplPath) { }
    }
    /// <summary>
    /// 请求类型
    /// </summary>
    public enum MethodType
    {
        NONE = 0,
        POST = 1,
        GET = 2,
        PUT = 3,
        DELETE = 4,
        AJAX = 5
    }
    /// <summary>
    /// 请求的内容类型
    /// </summary>
    public enum ContentType
    {
        NONE = 0,
        Application_x_www_form_urlencoded = 1,
        Multipart_form_data = 2,
        Application_json = 3,
        Text_xml = 4,
        Application_octet_stream = 5
    }
    /// <summary>
    /// 服务器类型
    /// </summary>
    public enum ServerType
    {
        /// <summary>
        /// IIS传统服务器
        /// </summary>
        AspNET,
        /// <summary>
        /// vNext服务器
        /// </summary>
        MicrosoftOwin,
        /// <summary>
        /// NFinal实现的Owin服务器
        /// </summary>
        NFinalOwin,
        /// <summary>
        /// 无服务器，静态页生成
        /// </summary>
        IsStatic,
        /// <summary>
        /// 未知
        /// </summary>
        UnKnown
    }
}
